package com.wmyg.scanninggun.dao;

import com.wmyg.scanninggun.bean.BillNew;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface BillNewMapper {

    @Insert({"insert into bill_new(operator,device_id,gtin,batch,case_id,creatime,state,factory_id,factory_name) " +
            "value(#{operator},#{deviceId},#{gtin},#{batch},#{caseId},#{creatime},#{state},#{factoryId},#{factoryName})"})
    @Options(useGeneratedKeys = true, keyProperty = "billId", keyColumn = "bill_id")
    int insert(BillNew billNew);

    int update(BillNew billNew);

    int batchInsertBox(BillNew billNew);

    List<BillNew> selectAllByNewBill(BillNew billNew);

    int selectValidCount(String deviceId, String startTime);

    int selectInvalidCount(String deviceId, String startTime);

}
